//
//  WRYVoiceView.m
//  BaiSiBuJie
//
//  Created by wry on 16/5/6.
//  Copyright © 2016年 WRY. All rights reserved.
//

#import "WRYVoiceView.h"
#import "WRYThemeItem.h"


@interface WRYVoiceView ()
@property (weak, nonatomic) IBOutlet UIImageView *imageVIew;

@property (weak, nonatomic) IBOutlet UIButton *playBtn;//播放按钮

@property (weak, nonatomic) IBOutlet UILabel *playCountLable;
@property (weak, nonatomic) IBOutlet UILabel *playLength;



@end
@implementation WRYVoiceView

-(void)setItem:(WRYThemeItem *)item
{
    [super setItem:item];
    [WRYLoadImageManager wry_setImageToImageView:_imageVIew WithURL:item.image0 placeholderImage:nil progress:nil completed:nil];
    
    
    NSInteger min =item.voicetime/60;
    NSInteger sec= item.voicetime%60;
    _playLength.text=[NSString stringWithFormat:@"%02zd:%02zd",min,sec];//02zd的意思:前面保留2为整数,不够2位,就在前面补0;
    
    
    CGFloat count=0;
    NSString  *str;
    if (item.playcount>10000) {
        
        count =1.0*item.playcount/10000;
        str= [NSString stringWithFormat:@"%.1f万播放",count];
        str= [str stringByReplacingOccurrencesOfString:@".0" withString:@""];
    }else{
        count =item.playcount;
        str= [NSString stringWithFormat:@"%f播放",count];
    }
    _playCountLable.text=str;
    
}




@end
